heck if the virtual environment exists
if [ -d "myenv" ]; then
    # Activate the virtual environment
    export VIRTUAL_ENV=$(pwd)/myenv
    export PATH=$VIRTUAL_ENV/bin:$PATH
    echo "Virtual environment activated: $VIRTUAL_ENV"
else
    echo "Virtual environment 'myenv' does not exist."
    exit 1
fi

# Verify that python3 points to the virtual environment
python_path=$(which python3)
if [[ $python_path == $VIRTUAL_ENV/bin/python3 ]]; then
    echo "python3 is using the virtual environment: $python_path"
else
    echo "python3 is not using the virtual environment. Check your PATH."
    exit 1
fi

# Check if main.py exists
if [ -f "main.py" ]; then
    # Run main.py in the background with nohup
    nohup python3 main.py > nohup_main.out 2>&1 &
    echo "main.py is running in the background. Output is in nohup_main.out."
else
    echo "main.py does not exist."
    exit 1
fi